{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "48d42ad9-d6c5-4d2b-86c4-ebd4bb937728",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签\n",
    "plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a76141d7-d727-4a95-bf33-18fa67933083",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pd.read_csv(\"data/ERP_FHJL.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "912003a7-089e-4400-b332-270930a82952",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>调度安排ID</th>\n",
       "      <th>客户信息ID</th>\n",
       "      <th>站点信息ID</th>\n",
       "      <th>客户下单ID</th>\n",
       "      <th>发货地信息ID</th>\n",
       "      <th>货品类型</th>\n",
       "      <th>产品规格</th>\n",
       "      <th>产品品牌</th>\n",
       "      <th>发货吨位</th>\n",
       "      <th>到站吨位</th>\n",
       "      <th>单价</th>\n",
       "      <th>货款</th>\n",
       "      <th>车辆信息</th>\n",
       "      <th>收货时间</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2509</td>\n",
       "      <td>3624</td>\n",
       "      <td>218</td>\n",
       "      <td>319</td>\n",
       "      <td>1978</td>\n",
       "      <td>103</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>8</td>\n",
       "      <td>38.38</td>\n",
       "      <td>0.0</td>\n",
       "      <td>207.0</td>\n",
       "      <td>7944.66</td>\n",
       "      <td>314</td>\n",
       "      <td>2022-07-21 07:10:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2510</td>\n",
       "      <td>3637</td>\n",
       "      <td>107</td>\n",
       "      <td>93</td>\n",
       "      <td>1981</td>\n",
       "      <td>124</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>45.56</td>\n",
       "      <td>0.0</td>\n",
       "      <td>340.0</td>\n",
       "      <td>15490.40</td>\n",
       "      <td>241</td>\n",
       "      <td>2022-07-21 07:19:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2514</td>\n",
       "      <td>3638</td>\n",
       "      <td>152</td>\n",
       "      <td>191</td>\n",
       "      <td>1986</td>\n",
       "      <td>121</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>43.84</td>\n",
       "      <td>0.0</td>\n",
       "      <td>320.0</td>\n",
       "      <td>14028.80</td>\n",
       "      <td>276</td>\n",
       "      <td>2022-07-21 10:49:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2515</td>\n",
       "      <td>3639</td>\n",
       "      <td>152</td>\n",
       "      <td>191</td>\n",
       "      <td>1986</td>\n",
       "      <td>121</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>52.20</td>\n",
       "      <td>0.0</td>\n",
       "      <td>320.0</td>\n",
       "      <td>16704.00</td>\n",
       "      <td>257</td>\n",
       "      <td>2022-07-21 10:49:35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2516</td>\n",
       "      <td>3666</td>\n",
       "      <td>139</td>\n",
       "      <td>141</td>\n",
       "      <td>1998</td>\n",
       "      <td>104</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>32.32</td>\n",
       "      <td>0.0</td>\n",
       "      <td>292.0</td>\n",
       "      <td>9437.44</td>\n",
       "      <td>163</td>\n",
       "      <td>2022-07-21 11:23:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49870</th>\n",
       "      <td>60712</td>\n",
       "      <td>62734</td>\n",
       "      <td>461</td>\n",
       "      <td>744</td>\n",
       "      <td>32869</td>\n",
       "      <td>104</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>36.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>1800.00</td>\n",
       "      <td>1345</td>\n",
       "      <td>2024-06-24 13:28:49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49871</th>\n",
       "      <td>60713</td>\n",
       "      <td>62747</td>\n",
       "      <td>609</td>\n",
       "      <td>1145</td>\n",
       "      <td>32886</td>\n",
       "      <td>105</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>41.16</td>\n",
       "      <td>0.0</td>\n",
       "      <td>155.0</td>\n",
       "      <td>6379.80</td>\n",
       "      <td>106</td>\n",
       "      <td>2024-06-24 14:08:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49872</th>\n",
       "      <td>60714</td>\n",
       "      <td>62748</td>\n",
       "      <td>103</td>\n",
       "      <td>87</td>\n",
       "      <td>32893</td>\n",
       "      <td>104</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>34.60</td>\n",
       "      <td>0.0</td>\n",
       "      <td>155.0</td>\n",
       "      <td>5363.00</td>\n",
       "      <td>226</td>\n",
       "      <td>2024-06-24 14:09:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49873</th>\n",
       "      <td>60715</td>\n",
       "      <td>62745</td>\n",
       "      <td>201</td>\n",
       "      <td>892</td>\n",
       "      <td>32890</td>\n",
       "      <td>104</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>40.64</td>\n",
       "      <td>0.0</td>\n",
       "      <td>170.0</td>\n",
       "      <td>6908.80</td>\n",
       "      <td>125</td>\n",
       "      <td>2024-06-24 14:40:16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49874</th>\n",
       "      <td>60716</td>\n",
       "      <td>62744</td>\n",
       "      <td>388</td>\n",
       "      <td>1278</td>\n",
       "      <td>32911</td>\n",
       "      <td>105</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>35.68</td>\n",
       "      <td>0.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>5352.00</td>\n",
       "      <td>766</td>\n",
       "      <td>2024-06-24 15:07:41</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>49875 rows × 15 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          ID  调度安排ID  客户信息ID  站点信息ID  客户下单ID  发货地信息ID  货品类型  产品规格  产品品牌  \\\n",
       "0       2509    3624     218     319    1978      103     1     1     8   \n",
       "1       2510    3637     107      93    1981      124     0     0     0   \n",
       "2       2514    3638     152     191    1986      121     0     0     0   \n",
       "3       2515    3639     152     191    1986      121     0     0     0   \n",
       "4       2516    3666     139     141    1998      104     1     1     9   \n",
       "...      ...     ...     ...     ...     ...      ...   ...   ...   ...   \n",
       "49870  60712   62734     461     744   32869      104     1     1     9   \n",
       "49871  60713   62747     609    1145   32886      105     1     1     9   \n",
       "49872  60714   62748     103      87   32893      104     1     1     9   \n",
       "49873  60715   62745     201     892   32890      104     1     1     9   \n",
       "49874  60716   62744     388    1278   32911      105     1     1     9   \n",
       "\n",
       "        发货吨位  到站吨位     单价        货款  车辆信息                 收货时间  \n",
       "0      38.38   0.0  207.0   7944.66   314  2022-07-21 07:10:48  \n",
       "1      45.56   0.0  340.0  15490.40   241  2022-07-21 07:19:48  \n",
       "2      43.84   0.0  320.0  14028.80   276  2022-07-21 10:49:34  \n",
       "3      52.20   0.0  320.0  16704.00   257  2022-07-21 10:49:35  \n",
       "4      32.32   0.0  292.0   9437.44   163  2022-07-21 11:23:31  \n",
       "...      ...   ...    ...       ...   ...                  ...  \n",
       "49870  36.00   0.0   50.0   1800.00  1345  2024-06-24 13:28:49  \n",
       "49871  41.16   0.0  155.0   6379.80   106  2024-06-24 14:08:54  \n",
       "49872  34.60   0.0  155.0   5363.00   226  2024-06-24 14:09:20  \n",
       "49873  40.64   0.0  170.0   6908.80   125  2024-06-24 14:40:16  \n",
       "49874  35.68   0.0  150.0   5352.00   766  2024-06-24 15:07:41  \n",
       "\n",
       "[49875 rows x 15 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns=[\"ID\",\"调度安排ID\",\"客户信息ID\",\"站点信息ID\",\"客户下单ID\",\"发货地信息ID\",\"货品类型\",\"产品规格\",\"产品品牌\",\"发货吨位\",\"到站吨位\",\"单价\",\"货款\",\"车辆信息\",\"收货时间\"]\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a62d0398-2ff5-45e2-8a50-3a291d3b21e4",
   "metadata": {},
   "source": [
    "# df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "e2289d70-afa1-4c7a-9deb-158f08588cd5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发货记录ID</th>\n",
       "      <th>发货记录完成时间</th>\n",
       "      <th>发货吨位</th>\n",
       "      <th>到站吨位</th>\n",
       "      <th>单价</th>\n",
       "      <th>货款</th>\n",
       "      <th>具体车牌号</th>\n",
       "      <th>客户信息ID</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2509</td>\n",
       "      <td>2022-07-21 07:10:48</td>\n",
       "      <td>38.38</td>\n",
       "      <td>0.0</td>\n",
       "      <td>207.0</td>\n",
       "      <td>7944.66</td>\n",
       "      <td>鄂L1D516</td>\n",
       "      <td>218</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2510</td>\n",
       "      <td>2022-07-21 07:19:48</td>\n",
       "      <td>45.56</td>\n",
       "      <td>0.0</td>\n",
       "      <td>340.0</td>\n",
       "      <td>15490.40</td>\n",
       "      <td>鄂AEJ919</td>\n",
       "      <td>107</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2514</td>\n",
       "      <td>2022-07-21 10:49:34</td>\n",
       "      <td>43.84</td>\n",
       "      <td>0.0</td>\n",
       "      <td>320.0</td>\n",
       "      <td>14028.80</td>\n",
       "      <td>鄂ASE558</td>\n",
       "      <td>152</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2515</td>\n",
       "      <td>2022-07-21 10:49:35</td>\n",
       "      <td>52.20</td>\n",
       "      <td>0.0</td>\n",
       "      <td>320.0</td>\n",
       "      <td>16704.00</td>\n",
       "      <td>鄂APP387</td>\n",
       "      <td>152</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2516</td>\n",
       "      <td>2022-07-21 11:23:31</td>\n",
       "      <td>32.32</td>\n",
       "      <td>0.0</td>\n",
       "      <td>292.0</td>\n",
       "      <td>9437.44</td>\n",
       "      <td>鄂APS131</td>\n",
       "      <td>139</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49870</th>\n",
       "      <td>60712</td>\n",
       "      <td>2024-06-24 13:28:49</td>\n",
       "      <td>36.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>1800.00</td>\n",
       "      <td>鄂AET276</td>\n",
       "      <td>461</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49871</th>\n",
       "      <td>60713</td>\n",
       "      <td>2024-06-24 14:08:54</td>\n",
       "      <td>41.16</td>\n",
       "      <td>0.0</td>\n",
       "      <td>155.0</td>\n",
       "      <td>6379.80</td>\n",
       "      <td>鄂ABQ252</td>\n",
       "      <td>609</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49872</th>\n",
       "      <td>60714</td>\n",
       "      <td>2024-06-24 14:09:20</td>\n",
       "      <td>34.60</td>\n",
       "      <td>0.0</td>\n",
       "      <td>155.0</td>\n",
       "      <td>5363.00</td>\n",
       "      <td>鄂ADM620</td>\n",
       "      <td>103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49873</th>\n",
       "      <td>60715</td>\n",
       "      <td>2024-06-24 14:40:16</td>\n",
       "      <td>40.64</td>\n",
       "      <td>0.0</td>\n",
       "      <td>170.0</td>\n",
       "      <td>6908.80</td>\n",
       "      <td>鄂ABB206</td>\n",
       "      <td>201</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49874</th>\n",
       "      <td>60716</td>\n",
       "      <td>2024-06-24 15:07:41</td>\n",
       "      <td>35.68</td>\n",
       "      <td>0.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>5352.00</td>\n",
       "      <td>鄂ACK879</td>\n",
       "      <td>388</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>49875 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       发货记录ID             发货记录完成时间   发货吨位  到站吨位     单价        货款    具体车牌号  \\\n",
       "0        2509  2022-07-21 07:10:48  38.38   0.0  207.0   7944.66  鄂L1D516   \n",
       "1        2510  2022-07-21 07:19:48  45.56   0.0  340.0  15490.40  鄂AEJ919   \n",
       "2        2514  2022-07-21 10:49:34  43.84   0.0  320.0  14028.80  鄂ASE558   \n",
       "3        2515  2022-07-21 10:49:35  52.20   0.0  320.0  16704.00  鄂APP387   \n",
       "4        2516  2022-07-21 11:23:31  32.32   0.0  292.0   9437.44  鄂APS131   \n",
       "...       ...                  ...    ...   ...    ...       ...      ...   \n",
       "49870   60712  2024-06-24 13:28:49  36.00   0.0   50.0   1800.00  鄂AET276   \n",
       "49871   60713  2024-06-24 14:08:54  41.16   0.0  155.0   6379.80  鄂ABQ252   \n",
       "49872   60714  2024-06-24 14:09:20  34.60   0.0  155.0   5363.00  鄂ADM620   \n",
       "49873   60715  2024-06-24 14:40:16  40.64   0.0  170.0   6908.80  鄂ABB206   \n",
       "49874   60716  2024-06-24 15:07:41  35.68   0.0  150.0   5352.00  鄂ACK879   \n",
       "\n",
       "       客户信息ID  \n",
       "0         218  \n",
       "1         107  \n",
       "2         152  \n",
       "3         152  \n",
       "4         139  \n",
       "...       ...  \n",
       "49870     461  \n",
       "49871     609  \n",
       "49872     103  \n",
       "49873     201  \n",
       "49874     388  \n",
       "\n",
       "[49875 rows x 8 columns]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1=pd.read_excel(\"df1.xlsx\")\n",
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "b6d07fef-058a-48da-9462-86224a7c7d21",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "has_duplicates = df1.duplicated().any()  \n",
    "print(has_duplicates)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "52970177-02fd-46c2-8033-07aa628943f2",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b467d715-ad2b-4f15-8565-ce087aaae3f3",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>客户信息ID</th>\n",
       "      <th>站点ID</th>\n",
       "      <th>货品类型</th>\n",
       "      <th>产品规格</th>\n",
       "      <th>产品品牌</th>\n",
       "      <th>发货吨位</th>\n",
       "      <th>运货方式</th>\n",
       "      <th>业务类型描述</th>\n",
       "      <th>发货地ID</th>\n",
       "      <th>到站时间</th>\n",
       "      <th>销售人员</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>79</td>\n",
       "      <td>37</td>\n",
       "      <td>46</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>100.00</td>\n",
       "      <td>1</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>121</td>\n",
       "      <td>2022-06-13 15:59:10</td>\n",
       "      <td>xssb</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>745</td>\n",
       "      <td>141</td>\n",
       "      <td>276</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>100.00</td>\n",
       "      <td>1</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>121</td>\n",
       "      <td>2022-06-29 05:46:42</td>\n",
       "      <td>DS0403001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>865</td>\n",
       "      <td>141</td>\n",
       "      <td>276</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>200.00</td>\n",
       "      <td>1</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>121</td>\n",
       "      <td>2022-07-01 04:30:19</td>\n",
       "      <td>DS0403001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>928</td>\n",
       "      <td>141</td>\n",
       "      <td>276</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>200.00</td>\n",
       "      <td>1</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>121</td>\n",
       "      <td>2022-07-02 10:46:07</td>\n",
       "      <td>DS0403001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>958</td>\n",
       "      <td>141</td>\n",
       "      <td>276</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>150.00</td>\n",
       "      <td>1</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>121</td>\n",
       "      <td>2022-07-03 04:27:59</td>\n",
       "      <td>DS0403001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27948</th>\n",
       "      <td>32911</td>\n",
       "      <td>388</td>\n",
       "      <td>1278</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>35.00</td>\n",
       "      <td>0</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>104</td>\n",
       "      <td>2024-06-24 08:05:00</td>\n",
       "      <td>DS0403003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27949</th>\n",
       "      <td>32912</td>\n",
       "      <td>636</td>\n",
       "      <td>1211</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>35.00</td>\n",
       "      <td>0</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>104</td>\n",
       "      <td>2024-06-24 08:05:00</td>\n",
       "      <td>DS0403003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27950</th>\n",
       "      <td>32913</td>\n",
       "      <td>497</td>\n",
       "      <td>1274</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>42.36</td>\n",
       "      <td>0</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>104</td>\n",
       "      <td>2024-06-05 08:05:00</td>\n",
       "      <td>chediao</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27951</th>\n",
       "      <td>32914</td>\n",
       "      <td>479</td>\n",
       "      <td>793</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>30.00</td>\n",
       "      <td>0</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>104</td>\n",
       "      <td>2024-06-24 08:05:00</td>\n",
       "      <td>DS0402003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27952</th>\n",
       "      <td>32915</td>\n",
       "      <td>546</td>\n",
       "      <td>979</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>9</td>\n",
       "      <td>30.00</td>\n",
       "      <td>0</td>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>105</td>\n",
       "      <td>2024-06-25 08:05:00</td>\n",
       "      <td>DS0403000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>27953 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          ID  客户信息ID  站点ID  货品类型  产品规格  产品品牌    发货吨位  运货方式         业务类型描述  \\\n",
       "0         79      37    46     0     0     0  100.00     1  配送 (贸易+起驳+运输)   \n",
       "1        745     141   276     0     0     0  100.00     1  配送 (贸易+起驳+运输)   \n",
       "2        865     141   276     0     0     0  200.00     1  配送 (贸易+起驳+运输)   \n",
       "3        928     141   276     0     0     0  200.00     1  配送 (贸易+起驳+运输)   \n",
       "4        958     141   276     0     0     0  150.00     1  配送 (贸易+起驳+运输)   \n",
       "...      ...     ...   ...   ...   ...   ...     ...   ...            ...   \n",
       "27948  32911     388  1278     1     1     9   35.00     0        自提 (贸易)   \n",
       "27949  32912     636  1211     1     1     9   35.00     0        自提 (贸易)   \n",
       "27950  32913     497  1274     1     1     9   42.36     0        自提 (贸易)   \n",
       "27951  32914     479   793     1     1     9   30.00     0        自提 (贸易)   \n",
       "27952  32915     546   979     1     1     9   30.00     0     配送 (贸易+运输)   \n",
       "\n",
       "       发货地ID                 到站时间       销售人员  \n",
       "0        121  2022-06-13 15:59:10       xssb  \n",
       "1        121  2022-06-29 05:46:42  DS0403001  \n",
       "2        121  2022-07-01 04:30:19  DS0403001  \n",
       "3        121  2022-07-02 10:46:07  DS0403001  \n",
       "4        121  2022-07-03 04:27:59  DS0403001  \n",
       "...      ...                  ...        ...  \n",
       "27948    104  2024-06-24 08:05:00  DS0403003  \n",
       "27949    104  2024-06-24 08:05:00  DS0403003  \n",
       "27950    104  2024-06-05 08:05:00    chediao  \n",
       "27951    104  2024-06-24 08:05:00  DS0402003  \n",
       "27952    105  2024-06-25 08:05:00  DS0403000  \n",
       "\n",
       "[27953 rows x 12 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3=pd.read_csv(\"data/ERP_KHXD.csv\")\n",
    "df3.columns=[\"ID\",\"客户信息ID\",\"站点ID\",\"货品类型\",\"产品规格\",\"产品品牌\",\"发货吨位\",\"运货方式\",\"业务类型描述\",\"发货地ID\",\"到站时间\",\"销售人员\"]\n",
    "df3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4644fb1d-b9b6-4464-a006-46fadeec3465",
   "metadata": {},
   "source": [
    "# df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "5c51721b-1c4d-439f-8145-0b921b1f3628",
   "metadata": {},
   "outputs": [],
   "source": [
    "df2=pd.read_excel(\"df2.xlsx\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "31d9b3bb-1c2e-418c-acab-af65164deba7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>业务类型描述</th>\n",
       "      <th>名称</th>\n",
       "      <th>客户名称</th>\n",
       "      <th>发货地名称</th>\n",
       "      <th>货品类型</th>\n",
       "      <th>产品规格</th>\n",
       "      <th>产品品牌</th>\n",
       "      <th>客户信息ID</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>三部测试</td>\n",
       "      <td>NaN</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>水泥</td>\n",
       "      <td>P.O42.5</td>\n",
       "      <td>海螺水泥</td>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>何义奎</td>\n",
       "      <td>盛华鑫</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>水泥</td>\n",
       "      <td>P.O42.5</td>\n",
       "      <td>海螺水泥</td>\n",
       "      <td>141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>何义奎</td>\n",
       "      <td>盛华鑫</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>水泥</td>\n",
       "      <td>P.O42.5</td>\n",
       "      <td>海螺水泥</td>\n",
       "      <td>141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>何义奎</td>\n",
       "      <td>盛华鑫</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>水泥</td>\n",
       "      <td>P.O42.5</td>\n",
       "      <td>海螺水泥</td>\n",
       "      <td>141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>何义奎</td>\n",
       "      <td>盛华鑫</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>水泥</td>\n",
       "      <td>P.O42.5</td>\n",
       "      <td>海螺水泥</td>\n",
       "      <td>141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27948</th>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>史丹</td>\n",
       "      <td>泽麟建材</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27949</th>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>史丹</td>\n",
       "      <td>枣阳翔吉顺</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>636</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27950</th>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>调度室</td>\n",
       "      <td>志扬云睿</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>497</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27951</th>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>甄常</td>\n",
       "      <td>荟聚源</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27952</th>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>李庭辉</td>\n",
       "      <td>湖北玖伍建材</td>\n",
       "      <td>武新二期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>546</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>27953 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              业务类型描述    名称    客户名称 发货地名称 货品类型     产品规格  产品品牌  客户信息ID\n",
       "0      配送 (贸易+起驳+运输)  三部测试     NaN  江南码头   水泥  P.O42.5  海螺水泥      37\n",
       "1      配送 (贸易+起驳+运输)   何义奎     盛华鑫  江南码头   水泥  P.O42.5  海螺水泥     141\n",
       "2      配送 (贸易+起驳+运输)   何义奎     盛华鑫  江南码头   水泥  P.O42.5  海螺水泥     141\n",
       "3      配送 (贸易+起驳+运输)   何义奎     盛华鑫  江南码头   水泥  P.O42.5  海螺水泥     141\n",
       "4      配送 (贸易+起驳+运输)   何义奎     盛华鑫  江南码头   水泥  P.O42.5  海螺水泥     141\n",
       "...              ...   ...     ...   ...  ...      ...   ...     ...\n",
       "27948        自提 (贸易)    史丹    泽麟建材  武新一期   矿粉      S95  武新矿粉     388\n",
       "27949        自提 (贸易)    史丹   枣阳翔吉顺  武新一期   矿粉      S95  武新矿粉     636\n",
       "27950        自提 (贸易)   调度室    志扬云睿  武新一期   矿粉      S95  武新矿粉     497\n",
       "27951        自提 (贸易)    甄常     荟聚源  武新一期   矿粉      S95  武新矿粉     479\n",
       "27952     配送 (贸易+运输)   李庭辉  湖北玖伍建材  武新二期   矿粉      S95  武新矿粉     546\n",
       "\n",
       "[27953 rows x 8 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "c9fb21dd-ea82-4ecd-9e97-c4c3d9509667",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n"
     ]
    }
   ],
   "source": [
    "has_duplicates = df2.duplicated().any()  \n",
    "print(has_duplicates)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "9c7cdd4f-154b-4fd2-8b73-b24cda67c77b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df2 = df2.drop_duplicates()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "903a5e12-a8cb-4c30-be54-33780a7d27ec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>业务类型描述</th>\n",
       "      <th>名称</th>\n",
       "      <th>客户名称</th>\n",
       "      <th>发货地名称</th>\n",
       "      <th>货品类型</th>\n",
       "      <th>产品规格</th>\n",
       "      <th>产品品牌</th>\n",
       "      <th>客户信息ID</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>三部测试</td>\n",
       "      <td>NaN</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>水泥</td>\n",
       "      <td>P.O42.5</td>\n",
       "      <td>海螺水泥</td>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>何义奎</td>\n",
       "      <td>盛华鑫</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>水泥</td>\n",
       "      <td>P.O42.5</td>\n",
       "      <td>海螺水泥</td>\n",
       "      <td>141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>何义奎</td>\n",
       "      <td>盛华鑫</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>何义奎</td>\n",
       "      <td>盛华鑫</td>\n",
       "      <td>江南码头</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>金盛兰矿粉</td>\n",
       "      <td>141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "      <td>夏云峰</td>\n",
       "      <td>合志瑞景</td>\n",
       "      <td>德旺码头</td>\n",
       "      <td>水泥</td>\n",
       "      <td>P.O42.5</td>\n",
       "      <td>东方希望水泥</td>\n",
       "      <td>74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27644</th>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>夏云峰</td>\n",
       "      <td>泽成建材</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>264</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27705</th>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>李庭辉</td>\n",
       "      <td>武汉睿宇泽丰贸易有限公司</td>\n",
       "      <td>武新二期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27785</th>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>李庭辉</td>\n",
       "      <td>湖北三泉水泥</td>\n",
       "      <td>鄂钢嘉华</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>178</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27851</th>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>调度室</td>\n",
       "      <td>华安水泥东湖分公司</td>\n",
       "      <td>武新二期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>650</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27872</th>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>调度室</td>\n",
       "      <td>武汉睿宇泽丰贸易有限公司</td>\n",
       "      <td>武新二期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "      <td>643</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1219 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              业务类型描述    名称          客户名称 发货地名称 货品类型     产品规格    产品品牌  客户信息ID\n",
       "0      配送 (贸易+起驳+运输)  三部测试           NaN  江南码头   水泥  P.O42.5    海螺水泥      37\n",
       "1      配送 (贸易+起驳+运输)   何义奎           盛华鑫  江南码头   水泥  P.O42.5    海螺水泥     141\n",
       "8      配送 (贸易+起驳+运输)   何义奎           盛华鑫  江南码头   矿粉      S95    武新矿粉     141\n",
       "9      配送 (贸易+起驳+运输)   何义奎           盛华鑫  江南码头   矿粉      S95   金盛兰矿粉     141\n",
       "13     配送 (贸易+起驳+运输)   夏云峰          合志瑞景  德旺码头   水泥  P.O42.5  东方希望水泥      74\n",
       "...              ...   ...           ...   ...  ...      ...     ...     ...\n",
       "27644        自提 (贸易)   夏云峰          泽成建材  武新一期   矿粉      S95    武新矿粉     264\n",
       "27705        自提 (贸易)   李庭辉  武汉睿宇泽丰贸易有限公司  武新二期   矿粉      S95    武新矿粉     643\n",
       "27785     配送 (贸易+运输)   李庭辉        湖北三泉水泥  鄂钢嘉华   矿粉      S95    武新矿粉     178\n",
       "27851     配送 (贸易+运输)   调度室     华安水泥东湖分公司  武新二期   矿粉      S95    武新矿粉     650\n",
       "27872        自提 (贸易)   调度室  武汉睿宇泽丰贸易有限公司  武新二期   矿粉      S95    武新矿粉     643\n",
       "\n",
       "[1219 rows x 8 columns]"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "bde942ba-a7e7-485f-a111-ca34407f32e9",
   "metadata": {},
   "outputs": [],
   "source": [
    "merged_df = pd.merge(df1, df2, on='客户信息ID', how='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "744fb7fa-eeb4-4851-8624-7d19fc507c95",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发货记录ID</th>\n",
       "      <th>发货记录完成时间</th>\n",
       "      <th>发货吨位</th>\n",
       "      <th>到站吨位</th>\n",
       "      <th>单价</th>\n",
       "      <th>货款</th>\n",
       "      <th>具体车牌号</th>\n",
       "      <th>客户信息ID</th>\n",
       "      <th>业务类型描述</th>\n",
       "      <th>名称</th>\n",
       "      <th>客户名称</th>\n",
       "      <th>发货地名称</th>\n",
       "      <th>货品类型</th>\n",
       "      <th>产品规格</th>\n",
       "      <th>产品品牌</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2509</td>\n",
       "      <td>2022-07-21 07:10:48</td>\n",
       "      <td>38.38</td>\n",
       "      <td>0.00</td>\n",
       "      <td>207.0</td>\n",
       "      <td>7944.66</td>\n",
       "      <td>鄂L1D516</td>\n",
       "      <td>218</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>钱多多</td>\n",
       "      <td>中昇东浩</td>\n",
       "      <td>金盛兰</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>金盛兰矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2509</td>\n",
       "      <td>2022-07-21 07:10:48</td>\n",
       "      <td>38.38</td>\n",
       "      <td>0.00</td>\n",
       "      <td>207.0</td>\n",
       "      <td>7944.66</td>\n",
       "      <td>鄂L1D516</td>\n",
       "      <td>218</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>吴家龙</td>\n",
       "      <td>中昇东浩</td>\n",
       "      <td>金盛兰</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>金盛兰矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2509</td>\n",
       "      <td>2022-07-21 07:10:48</td>\n",
       "      <td>38.38</td>\n",
       "      <td>0.00</td>\n",
       "      <td>207.0</td>\n",
       "      <td>7944.66</td>\n",
       "      <td>鄂L1D516</td>\n",
       "      <td>218</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>管理员</td>\n",
       "      <td>中昇东浩</td>\n",
       "      <td>金盛兰</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>金盛兰矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2542</td>\n",
       "      <td>2022-07-22 01:07:50</td>\n",
       "      <td>38.02</td>\n",
       "      <td>0.00</td>\n",
       "      <td>207.0</td>\n",
       "      <td>7870.14</td>\n",
       "      <td>鄂L1D516</td>\n",
       "      <td>218</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>钱多多</td>\n",
       "      <td>中昇东浩</td>\n",
       "      <td>金盛兰</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>金盛兰矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2542</td>\n",
       "      <td>2022-07-22 01:07:50</td>\n",
       "      <td>38.02</td>\n",
       "      <td>0.00</td>\n",
       "      <td>207.0</td>\n",
       "      <td>7870.14</td>\n",
       "      <td>鄂L1D516</td>\n",
       "      <td>218</td>\n",
       "      <td>自提 (贸易)</td>\n",
       "      <td>吴家龙</td>\n",
       "      <td>中昇东浩</td>\n",
       "      <td>金盛兰</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>金盛兰矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293025</th>\n",
       "      <td>60175</td>\n",
       "      <td>2024-06-15 06:24:05</td>\n",
       "      <td>31.64</td>\n",
       "      <td>31.64</td>\n",
       "      <td>177.0</td>\n",
       "      <td>5600.28</td>\n",
       "      <td>鄂AYX722</td>\n",
       "      <td>649</td>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>钱多多</td>\n",
       "      <td>慧迪（授信）</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293026</th>\n",
       "      <td>60649</td>\n",
       "      <td>2024-06-23 04:27:01</td>\n",
       "      <td>31.50</td>\n",
       "      <td>31.63</td>\n",
       "      <td>177.0</td>\n",
       "      <td>5575.50</td>\n",
       "      <td>鄂ABX150</td>\n",
       "      <td>649</td>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>钱多多</td>\n",
       "      <td>慧迪（授信）</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293027</th>\n",
       "      <td>60665</td>\n",
       "      <td>2024-06-23 14:09:08</td>\n",
       "      <td>31.70</td>\n",
       "      <td>31.45</td>\n",
       "      <td>177.0</td>\n",
       "      <td>5610.90</td>\n",
       "      <td>鄂AUN017</td>\n",
       "      <td>649</td>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>钱多多</td>\n",
       "      <td>慧迪（授信）</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293028</th>\n",
       "      <td>60689</td>\n",
       "      <td>2024-06-24 01:09:51</td>\n",
       "      <td>31.92</td>\n",
       "      <td>31.87</td>\n",
       "      <td>177.0</td>\n",
       "      <td>5649.84</td>\n",
       "      <td>鄂AFX865</td>\n",
       "      <td>649</td>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>钱多多</td>\n",
       "      <td>慧迪（授信）</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293029</th>\n",
       "      <td>60691</td>\n",
       "      <td>2024-06-24 06:02:09</td>\n",
       "      <td>32.76</td>\n",
       "      <td>32.62</td>\n",
       "      <td>177.0</td>\n",
       "      <td>5798.52</td>\n",
       "      <td>鄂AYX722</td>\n",
       "      <td>649</td>\n",
       "      <td>配送 (贸易+运输)</td>\n",
       "      <td>钱多多</td>\n",
       "      <td>慧迪（授信）</td>\n",
       "      <td>武新一期</td>\n",
       "      <td>矿粉</td>\n",
       "      <td>S95</td>\n",
       "      <td>武新矿粉</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>293030 rows × 15 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        发货记录ID             发货记录完成时间   发货吨位   到站吨位     单价       货款    具体车牌号  \\\n",
       "0         2509  2022-07-21 07:10:48  38.38   0.00  207.0  7944.66  鄂L1D516   \n",
       "1         2509  2022-07-21 07:10:48  38.38   0.00  207.0  7944.66  鄂L1D516   \n",
       "2         2509  2022-07-21 07:10:48  38.38   0.00  207.0  7944.66  鄂L1D516   \n",
       "3         2542  2022-07-22 01:07:50  38.02   0.00  207.0  7870.14  鄂L1D516   \n",
       "4         2542  2022-07-22 01:07:50  38.02   0.00  207.0  7870.14  鄂L1D516   \n",
       "...        ...                  ...    ...    ...    ...      ...      ...   \n",
       "293025   60175  2024-06-15 06:24:05  31.64  31.64  177.0  5600.28  鄂AYX722   \n",
       "293026   60649  2024-06-23 04:27:01  31.50  31.63  177.0  5575.50  鄂ABX150   \n",
       "293027   60665  2024-06-23 14:09:08  31.70  31.45  177.0  5610.90  鄂AUN017   \n",
       "293028   60689  2024-06-24 01:09:51  31.92  31.87  177.0  5649.84  鄂AFX865   \n",
       "293029   60691  2024-06-24 06:02:09  32.76  32.62  177.0  5798.52  鄂AYX722   \n",
       "\n",
       "        客户信息ID      业务类型描述   名称    客户名称 发货地名称 货品类型 产品规格   产品品牌  \n",
       "0          218     自提 (贸易)  钱多多    中昇东浩   金盛兰   矿粉  S95  金盛兰矿粉  \n",
       "1          218     自提 (贸易)  吴家龙    中昇东浩   金盛兰   矿粉  S95  金盛兰矿粉  \n",
       "2          218     自提 (贸易)  管理员    中昇东浩   金盛兰   矿粉  S95  金盛兰矿粉  \n",
       "3          218     自提 (贸易)  钱多多    中昇东浩   金盛兰   矿粉  S95  金盛兰矿粉  \n",
       "4          218     自提 (贸易)  吴家龙    中昇东浩   金盛兰   矿粉  S95  金盛兰矿粉  \n",
       "...        ...         ...  ...     ...   ...  ...  ...    ...  \n",
       "293025     649  配送 (贸易+运输)  钱多多  慧迪（授信）  武新一期   矿粉  S95   武新矿粉  \n",
       "293026     649  配送 (贸易+运输)  钱多多  慧迪（授信）  武新一期   矿粉  S95   武新矿粉  \n",
       "293027     649  配送 (贸易+运输)  钱多多  慧迪（授信）  武新一期   矿粉  S95   武新矿粉  \n",
       "293028     649  配送 (贸易+运输)  钱多多  慧迪（授信）  武新一期   矿粉  S95   武新矿粉  \n",
       "293029     649  配送 (贸易+运输)  钱多多  慧迪（授信）  武新一期   矿粉  S95   武新矿粉  \n",
       "\n",
       "[293030 rows x 15 columns]"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "merged_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "7369979b-b3e6-432d-88c0-1b2454aec119",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "has_duplicates = merged_df.duplicated().any()  \n",
    "print(has_duplicates)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "73a3f037-a93a-404b-9e5e-a61776a7c447",
   "metadata": {},
   "outputs": [],
   "source": [
    "merged_df.to_excel(\"merged_df.xlsx\",index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "cd98756b-3543-4a24-8fc6-8bc1c390efee",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pd.DataFrame(merged_df[\"发货记录ID\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "461d23ca-868f-4d45-a63c-9366275d8ed2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发货记录ID</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2509</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2509</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2509</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2542</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2542</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293025</th>\n",
       "      <td>60175</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293026</th>\n",
       "      <td>60649</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293027</th>\n",
       "      <td>60665</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293028</th>\n",
       "      <td>60689</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293029</th>\n",
       "      <td>60691</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>293030 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        发货记录ID\n",
       "0         2509\n",
       "1         2509\n",
       "2         2509\n",
       "3         2542\n",
       "4         2542\n",
       "...        ...\n",
       "293025   60175\n",
       "293026   60649\n",
       "293027   60665\n",
       "293028   60689\n",
       "293029   60691\n",
       "\n",
       "[293030 rows x 1 columns]"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"发货记录完成时间\"]=merged_df[\"发货记录完成时间\"]\n",
    "df[\"销售员名称\"]=merged_df[\"名称\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "60b9ded8-7b5c-4cec-8d0d-347a1212c47b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
